package com.dong.ioc.annotation;

import com.dong.ioc.annotation.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Required;

import java.util.Arrays;

/**
 * description
 *
 * @author Administrator 2021/08/31 14:35
 */
public class User {

    @Autowired
    @Qualifier("main")
    private Account[] account;
    private String username;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public User() {
    }

    @Autowired(required = false)
    public User(Account[] account) {
        this.account = account;
    }

    @Autowired
    public void prepare(Account[] account){
        this.account = account;
    }

    public Account[] getAccount() {
        return account;
    }

    @Required
    @Autowired
    public void setAccount(Account[] account) {
        this.account = account;
    }

    @Override
    public String toString() {
        return "User{" +
                "account=" + Arrays.toString(account) +
                '}';
    }
}
